<%@ Page Language="C#" Theme="Defaultsys" AutoEventWireup="true" CodeFile="CallFinishedPageAdministration.aspx.cs"
    Inherits="CallFinishedPageAdministration" Title="Rapport Plan System - Call finished page administration"
    MasterPageFile="~/MasterPage.master" %>

<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1">
    <link rel="stylesheet" type="text/css" media="all" href="jscripts/date/calendar-tas.css" title="win2k-cold-1" />

    <script type="text/javascript" src="jscripts/date/calendar.js"></script>

    <script type="text/javascript" src="jscripts/date/calendar-setup.js"></script>

    <script type="text/javascript">   
    
     function ValidateSymbols(oSrc, args)
        {
            args.IsValid = true;
            str = args.Value;
            for (i=0; i<str.length; i++ )
            { 
                if ((str.charAt(i) < '0') || (str.charAt(i) > '9'))
                    args.IsValid = false;
            }
        } 
    
    </script>

    <table border="0" width="100%" cellpadding="0" cellspacing="0">
        <tr>
            <td class="contTable">
                <asp:GridView ID="grdPageFields" SkinID="gvGrid" runat="server" AllowPaging="false"
                    AutoGenerateColumns="False" DataKeyNames="CallPageFinishedFieldId" OnRowCommand="RowCommand"
                    Width="100%">
                    <Columns>
                        <asp:BoundField HeaderText="Property" DataField="Name" SortExpression="Name"
                            HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" />
                        <asp:BoundField HeaderText="Type" DataField="Type" SortExpression="Type" 
                            HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"/>
                            
                        <asp:TemplateField HeaderText="Order" HeaderStyle-Width="10%" 
                            HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <asp:TextBox ID="txtOrder" Width="30" runat="server" Text='<%# Eval("OrderIndex") %>'></asp:TextBox>
                                <asp:CustomValidator ID="CustomValidator6" runat="server" ClientValidationFunction="ValidateSymbols"
                                    ControlToValidate="txtOrder" Display="Dynamic" ErrorMessage="Order must be positiv number"
                                    SetFocusOnError="True">*</asp:CustomValidator>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="Edit" HeaderStyle-Width="10%" 
                            HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandArgument='<%# Eval("CallPageFinishedFieldId") %>' />
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="Remove" HeaderStyle-Width="10%" 
                            HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:CheckBox ID="ckRemove" runat="server"></asp:CheckBox>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="Id" Visible="false">
                            <ItemTemplate>
                                <asp:TextBox ID="id" runat="server" Visible="false" Text='<%# Eval("CallPageFinishedFieldId") %>'></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <%-- <table>
    <tr>
    <td>
     <asp:CustomValidator ID="CustomValidator6" runat="server" ClientValidationFunction="ValidateSymbols"
                            ControlToValidate="txtOrder" Display="Dynamic" ErrorMessage="Order must be positiv number"
                            SetFocusOnError="True">*</asp:CustomValidator> 
    </td>
    </tr>
    </table>--%>

                <script type="text/javascript">
  for (i=0; i<=9; i++){
    if (document.getElementById("ctl00_ContentPlaceHolder1_grdPageFields_ctl0"+i+"_txtDateTimeId")!= null){
    Calendar.setup({
        inputField     :    "ctl00_ContentPlaceHolder1_grdPageFields_ctl0"+i+"_txtDateTimeId",     // id of the input field
        ifFormat       :    "%m/%d/%Y",    // format of the input field
        button         :    "ctl00_ContentPlaceHolder1_grdPageFields_ctl0"+i+"_dateId",  // trigger for the calendar (button ID)
        singleClick    :    true
    });
    }
  }
    
                </script>

                <!--
     <table border="1" width="100%">
         <tr>
             <td>Property</td>
             <td>Type</td>
             <td width="5%">Order</td>
             <td width="5%">Remove</td>
         </tr>
         <tr>
             <td>Call done at:</td>
             <td><asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox></td>
             <td><asp:TextBox ID="txtOrderIndex1" runat="server" Width="36px">1</asp:TextBox></td>
             <td align="center"><asp:CheckBox ID="ckField" runat="server" /></td>
         </tr>
         <tr>
             <td>
                 Notes and conclusions</td>
             <td>
                 <asp:TextBox ID="txtSecondName" runat="server"></asp:TextBox></td>
             <td>
                 <asp:TextBox ID="txtOrderIndex2" runat="server" Width="36px">2</asp:TextBox></td>
             <td align="center">
                 <asp:CheckBox ID="ckField1" runat="server" /></td>
         </tr>
     </table>
     -->
                <asp:Button ID="btnAddNewField" runat="server" Text="Add new field" OnClick="AddNewField" />
                <asp:Button ID="btnRemoveFields" runat="server" Text="Remove fields" OnClick="RemoveField" />
                <asp:Button ID="btnModifyFieldOrder" runat="server" Text="Modify field order" OnClick="ModifyFieldOrder" />
            </td>
        </tr>
    </table>
</asp:Content>
